From: Alexandre Emsenhuber Date: Mon, 6 Dec 2010 17:42:14 +0000 (+0000) Subject: Check for the "search" along with other checks to create the Title object. Since... X-Git-Tag: 1.31.0-rc.0~33515 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=4d3788c0ff72d18494bcf7c3c33dc05770bc4168;p=lhc%2Fweb%2Fwiklou.git Check for the "search" along with other checks to create the Title object. Since this was done after the call to $wgOut->setTitle(), the Title object holded in that instance was incorrect when a such request happened --- diff --git a/includes/Wiki.php b/includes/Wiki.php index bc5ad01368..d8bd09cd22 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -55,7 +55,7 @@ class MediaWiki { wfRunHooks( 'BeforeInitialize', array( &$title, &$article, &$output, &$user, $request, $this ) ); - if( !$this->preliminaryChecks( $title, $output, $request ) ) { + if( !$this->preliminaryChecks( $title, $output ) ) { wfProfileOut( __METHOD__ ); return; } @@ -110,7 +110,12 @@ class MediaWiki { } $curid = $wgRequest->getInt( 'curid' ); - if( $curid ) { + if( $wgRequest->getCheck( 'search' ) ) { + // Compatibility with old search URLs which didn't use Special:Search + // Just check for presence here, so blank requests still + // show the search page when using ugly URLs (bug 8054). + $ret = SpecialPage::getTitleFor( 'Search' ); + } elseif( $curid ) { // URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); } elseif( $title == '' && $action != 'delete' ) { @@ -137,22 +142,13 @@ class MediaWiki { } /** - * Checks for search query and anon-cannot-read case + * Checks for anon-cannot-read case * * @param $title Title * @param $output OutputPage - * @param $request WebRequest * @return boolean true if successful */ - function preliminaryChecks( &$title, &$output, $request ) { - if( $request->getCheck( 'search' ) ) { - // Compatibility with old search URLs which didn't use Special:Search - // Just check for presence here, so blank requests still - // show the search page when using ugly URLs (bug 8054). - - // Do this above the read whitelist check for security... - $title = SpecialPage::getTitleFor( 'Search' ); - } + function preliminaryChecks( &$title, &$output ) { // If the user is not logged in, the Namespace:title of the article must be in // the Read array in order for the user to see it. (We have to check here to // catch special pages etc. We check again in Article::view())